<?php
require_once 'Common.php';
class ElemeApi extends Common
{
    /*
        添加店铺
        params
            store_id 门店ID
            chn_store_id 第三方门店ID
    */
    public function addStoreInfo($store_id = 0, $chn_store_id = 0)
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "getShop";
        
        $data = array();
        $data['store_id'] = $store_id; 
        $data['chn_store_id'] = $chn_store_id; 

        return $this->reqSvc($action, $data);
    }

    /*
        修改店铺
        params
            chn_id 渠道id
            store_id 店铺id
            other_shop_name 第三方药店名称
            other_shop_desc 第三方药店广告
            start_time 营业开始时间
            end_time 营业结束时间
            shipping_fee 配送费
            store_status 店铺状态
    */
    public function updateStoreInfo($chn_id = 0, $store_id = 0, $other_shop_name = '', $other_shop_desc = '', $start_time = '', $end_time = '', $shipping_fee = 0, $store_status = 0)
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "updateShop";


        $data = array();
        $data['chn_id'] = $chn_id; 
        $data['store_id'] = $store_id; 
        $data['other_shop_name'] = $other_shop_name;
        $data['other_shop_desc'] = $other_shop_desc; 
        $data['start_time'] = $start_time; 
        $data['end_time'] = $end_time; 
        $data['shipping_fee'] = $shipping_fee; 
        $data['store_status'] = $store_status; 

        return $this->reqSvc($action, $data);
    }

    /*
        初始化分类
        params
            store_id 门店ID
    */
    public function initCategoryInfo($store_id = 0)
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "initCategoryInfo";
        
        $data = array();
        $data['store_id'] = $store_id; 

        return $this->reqSvc($action, $data);
    }

    /*
        添加自定义分类
        params
            store_id 店铺id
            category_id 商品分类id
            other_category_name 第三方分类名称
    */
    public function addCategoryInfo($store_id = 0, $category_id = 0, $other_category_name = '')
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "createCategory";

        $data = array();
        $data['store_id'] = $store_id;
        $data['category_id'] = $category_id;
        $data['category_name'] = $other_category_name;
        $data['description'] = $other_category_name;

        return $this->reqSvc($action, $data);
    }

    /*
        删除第三方分类
        params
            store_id 店铺id
            other_category_id 第三方分类id
    */
    public function delCategoryInfo($store_id = 0, $other_category_id = '')
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "removeCategory";

        $data = array();
        $data['store_id'] = $store_id;
        $data['other_category_id'] = $other_category_id;

        return $this->reqSvc($action, $data);
    }

    /*
        更新第三方分类
        params
            other_category_id 第三方分类id
            other_category_name 第三方分类名称
    */
    public function updateCategoryInfo($other_category_id = 0, $other_category_name = '')
    {
        $action = array();
        $action['m'] = "ElemeApi";
        $action['a'] = "updateCategory";

        $data = array();
        $data['other_category_id'] = $other_category_id;
        $data['other_category_name'] = $other_category_name;

        return $this->reqSvc($action, $data);
    }

}
?>